Xbasic

SQL::UpdateStatementExecute Method

Syntax

Result_Flag as L = Execute([SQLConnection as SQL::Connection | SQLConnectionString as C] [, Arguments as SQL::Arguments | Arguments as C])

Arguments

Result_Flag

TRUE (.T.) if the operation was successful; otherwise FALSE (.F.).

SQL::UpdateStatement

A SQL::UpdateStatement object.

SQLConnection

Optional. A SQL::Connection object created with a DIM statement and with a defined .ConnectionString property.

Arguments

Optional. A connection string.

Description

Execute the current statement using the current or passed connection. Optionally providing argument values as an object or as XML.

Note: Argument values are merged with those already set on the query.

The .Execute() method retrieves data and populates a SQL::ResultSet object. It connects to the back-end database using the information in the SQL::Connection::ConnectionString property or in the ConnectString string, then executes the SQL statement in the SQL::UpdateStatement.SQLStatement property.

Example

dim conn as SQL::Connection
dim connString as C
dim upd as SQL::UpdateStatement
dim sql_update as C
connString = "{A5API='Access', FileName='c:\program files\a5v7\mdbfiles\alphasports.mdb'}"
sql_update = "update customer set bill_city = 'Phoenix', bill_postal_code = '08000', bill_state_region = 'AZ' where customer_id = 1"
if .not. conn.open(connString) then
    end
end if
if .not. upd.parse(sql_update) then
    ui_msg_box("Error", upd.callresult.text)
    end
end if
if .not. upd.execute(conn) then
    end
end if

See Also